package com.jboltai.scheduler;

import com.jboltai.config.JBoltAIConfig;
import com.jboltai.event.Event;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public abstract class Scheduler<T extends Event> extends Thread{
    private static final Logger LOGGER = LoggerFactory.getLogger(JBoltAIConfig.LOGGER_NAME);

    public Scheduler(String name) {
        super("event-scheduler-" + name);
    }




    @Override
    public void run() {
        process();
    }

    /**
     * 发布一个事件
     * @param event
     */
    abstract void publish(T event);


    /**
     * 处理队列中的事件
     */
    abstract void process();

    /**
     * 立即调用资源执行事件
     * @param event
     */
    abstract void dispatch(T event);

}
